//
//  JOView.m
//  view拖拽
//
//  Created by song on 15/3/7.
//  Copyright (c) 2015年 song. All rights reserved.
//

#import "JOView.h"

@implementation JOView

/**
 *  触摸开始（手指刚碰到view）
 *
 *  @param touches <#touches description#>
 *  @param event   <#event description#>
 */
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//    NSLog(@"touchesBegan");
    UITouch *touch  =[touches anyObject];
    
    NSLog(@"%d",touch.tapCount);
}
/**
 *  触摸结束(手指)
 *
 *  @param touches <#touches description#>
 *  @param event   <#event description#>
 */
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint current =[touch locationInView:self];
    
    CGPoint previous = [touch previousLocationInView:self];
    
    CGPoint center = self.center;
    center.x +=current.x - previous.x;
    center.y +=current.y -previous.y;
    self.center =center;
    
//    NSLog(@"%@",NSStringFromCGPoint(pos));
}

/**
 *  触摸ing
 *
 *  @param touches <#touches description#>
 *  @param event   <#event description#>
 */
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
//     NSLog(@"touchesEnded");
}
@end
